Central Event System (Plug-ins)

Available Events

There are 2 events fired by the Central Event System; Action and NeedObject. The Action event fires when an action is performed by the code (eg. result sorting, document reading etc). The NeedObject event fires when certain objects are created, this event allows the object type to be overridden with a subclass.

Action Event

The event arguments for an Action event are of type ActionEventArgs which has a property Name. The Name specifies what action has occurred, see below for a list of names, their description and what object can be found in the ActionEventArgs.Data property.

(Please also see the Keyoti.SearchEngine.Events.ActionName type under the API documentation ('Namespaces') for a complete up to date list.)

ActionEventArgs.NameDescription
AutoAssignContentThe content category for a document was auto assigned, Data contains the Document object.
AutoAssignLocationThe location category for a document was auto assigned, Data contains the Document object.
CalculateWordRelevanciesThe words have been read from a document that is being indexed and each word has been assigned a weight, Data contains the ArrayList from Document.CalculateWordRelevancies method argument.
DocumentBeingCrawledThe crawlable links in a document are being processed, Data contains a 2 element object array - the 1st element is the Document object being crawled, and the 2nd element is an ArrayList of Uri objects found as links in the Document.
DocumentImporterAddingDocumentA document is about to be imported from an indexable source, Data contains AddDocumentEventArgs object, which has a Cancel property to enable canceling of this action.
DocumentIndexBuildThe index has been built, Data is null/nothing.
DocumentIndexedA document has been indexed, Data is the Document object.
DiscoverLinkedURLsNew URLs have been found by reading document links, Data contains an ArrayList of string objects (the link URLs), which can be modified.
GetWordVariationsVariations (typically lemmas via stemming) of a word are required. Data contains a 2 element object array; first element is a Word object for the word that variations are needed for, and the second element is an ArrayList of strings holding the variations. The second element can be modified as desired.
IsDocumentToBeCrawledThe document has been checked to see if it will be crawled, Data contains IsDocumentToBeCrawledEventData and the WillCrawl property may be changed.
IsDocumentToBeIndexedThe document has been checked to see if it will be crawled, Data contains IsDocumentToBeIndexedEventData and WillIndex property may be changed.
ReadLinksThe links in a document have been read, Data contains ArrayList of URL strings.
ReadTextThe text in a document has been read, Data contains DocumentText object.
ResultItemsFinalizedThe search result items have been found and sorted, Data contains an ArrayList of ResultItem objects - the order and content of which may be changed.
UseDocumentEncoding The Encoding of a document is about to be used, Data contains the Document - the Encoding property may be read and/or set to the required value.

NeedObject Event

The event arguments for a NeedObject event are of type NeedObjectEventArgs, which has properties;
RequiredObject: holding an object of the type needed - the instance set in RequiredObject will be used by the engine, and so this can be modified or reset with a new instance (of a sub-class for example).
Configuration: holding the current Configuration instance

Handling the NeedObject event allows sub-classes of standard types to be injected into the code. Below is a list of classes for which a NeedObject is raised.

ClassTypical Timing
DocumentWhen a new Document instance is created, eg. during import and indexing.
ReaderWhen a document is about to be read, eg. during import and indexing
ParserProviderWhen a document is about to be parsed into words. Provides the provider for the file type

The list of available events will expand with subsequent versions - if you need a specific event, please email support@keyoti.com for inclusion.